import Form from '../../packages/form';
import FormItem from '../../packages/form-item';

describe('FormItem', () => {
  it('动态修改rules, 校验依然能够生效', () => {
    cy.mount(FormItem, {
      parentComponent: Form,
      propsData: {
        rules: null
      }
    });
    cy.get('@vue')
      .invoke('setProps', {
        rules: { required: true, message: '测试必填项' }
      });
    cy.get('@vue').then((wrapper) => {
      console.log(wrapper, '1');
      wrapper.vm.$emit('el.form.change');
    });
    cy.get('@vue').should((wrapper) => {
      expect(wrapper.vm.validateState).to.eq('error');
    });
  });
});
